//
//  QBHomeTitleButton.swift
//  Wei91BoiOS
//
//  Created by bing on 16/3/24.
//  Copyright © 2016年 bing. All rights reserved.
//

import UIKit

class QBHomeTitleButton: UIButton {
    
    convenience init(title: String?, imageName: String) {
        self.init()
        setTitle(title, forState: UIControlState.Normal)
        setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        sizeToFit()
    }
    
    
    override func layoutSubviews() {
        super.layoutSubviews()
        // swift可以直接设置结构体里面的成员
        titleLabel?.frame.origin.x = 0
        // 图片移动到label后面
        imageView?.frame.origin.x = titleLabel!.frame.width + 3
        
    }
}
